import Vue from 'vue'
import './cube-ui'
import App from './App.vue'
import router from './router'
import axios from 'axios'
import Vuex from 'vuex';

import 'element-ui/lib/theme-chalk/index.css';
import { Select, Option } from 'element-ui';
Vue.use(Select);
Vue.use(Option);

import 'ant-design-vue/dist/antd.css';
import { Slider } from 'ant-design-vue';
Vue.use(Slider);


Vue.config.productionTip = false
Vue.prototype.$axios = axios


//打包注释掉  //打包删除
// axios.defaults.baseURL = '/api/'


//使用vuex
Vue.use(Vuex)
const store = new Vuex.Store({
    state: {
        index: ""
    },
    //mutations改变state的唯一方法
    mutations: {
        start(...s) {
            // console.log(s[1], "store数据");
            this.state.index = s[1];
        }
    },
    //用与计算mutations
    actions: {
        click1() {
            // this.state.isclick = true;
        }
    },
    //用与计算mutations
    getters: {

    }
});

router.beforeEach((to, from, next) => {
    // if (to.meta.title) {
    //   document.title = to.meta.title
    // }
    const type = to.meta.type

    next();


    // 判断该路由是否需要登录权限
    // if (type !== 'nologin') {
    //     axios.post("/index/Publics/isneedlogin")
    //         .then(res => {
    //             console.log(res.data.code)
    //             // next();
    //             if (res.data.code != 10000) {
    //                 next();
    //             } else {
    //                 next("/") // 确保一定要有next()被调用
    //             }
    //         })

    // } else {
    //     next();
    // }

})

new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')